﻿using System;
using System.Runtime.InteropServices;
using UnityEngine;

[Serializable, StructLayout(LayoutKind.Sequential)]
public struct SerializableColor
{
    public float r;
    public float g;
    public float b;
    public float a;
    public SerializableColor(Color value)
    {
        this.r = value.r;
        this.g = value.g;
        this.b = value.b;
        this.a = value.a;
    }

    public static implicit operator Color(SerializableColor value)
    {
        return new Color(value.r, value.g, value.b, value.a);
    }

    public static implicit operator SerializableColor(Color value)
    {
        return new SerializableColor(value);
    }
}

